package com.ln.dm1031.demo04;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/10/31 15:26
 */
public class Belle implements Runnable{
    private BankCard bankCard;
    public Belle(BankCard bankCard){
        this.bankCard=bankCard;
    }
    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            if (bankCard.getBalance()>=5000){
                bankCard.setBalance(bankCard.getBalance()-5000);
                System.out.println(Thread.currentThread().getName()+"向卡中取出5000,卡中余额:"+bankCard.getBalance());
            }else {
                System.out.println("卡中余额不足,该换男朋友了");

            }
        }
    }
}
